<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="s_person" :rules="rules" label-width="100px" id="mvcfm">
      <el-button @click="myconfigureSubmit('')" type='success' size="mini"><i class='fa fa-check'></i>保存</el-button>
      <el-button @click="gotoPage('/oa/autooffice/Myacount?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>返回</el-button>
      <div class="form-unit">
        <span class="mvc-title-left"> 员工基本信息 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="12">
            <el-form-item label="姓名" prop="person_name">
              <el-input v-model="s_person.person_name" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="出生年月" prop="person_birthday">
              <el-date-picker v-model="s_person.person_birthday" type="date" style='width:100%' value-format="yyyy-MM-dd" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="性别" prop="person_sex">
              <el-radio-group v-model="s_person.person_sex">
                <el-radio-button label="男">男</el-radio-button>
                <el-radio-button label="女">女</el-radio-button>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="政治面貌" prop="person_politics">
              <el-select style='width:100%' v-model="s_person.person_politics">
                <el-option label="－－无－－" value='' />
                <el-option v-for="dict in l_pf" :key="dict.__code" :label="dict.__desc" :value="dict.__code"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="证件类别" prop="person_papercate">
              <el-select style='width:100%' v-model="s_person.person_papercate">
                <el-option label="－－无－－" value='' />
                <el-option v-for="dict in l_pt" :key="dict.__code" :label="dict.__desc" :value="dict.__code"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="证件号码" prop="person_paperno">
              <el-input v-model="s_person.person_paperno" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="证件上传" prop="">
              <input type=file />
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <div class="form-unit">
        <span class="mvc-title-left"> 员工通讯信息 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="12">
            <el-form-item label="家庭实际住址" prop="relation_address">
              <el-input v-model="s_relation.relation_address" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="邮编" prop="relation_zip">
              <el-input v-model="s_relation.relation_zip" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="电话" prop="relation_tel">
              <el-input v-model="s_relation.relation_tel" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="手机" prop="relation_cel">
              <el-input v-model="s_relation.relation_cel" />
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <el-table :data="s_email">
        <el-table-column label="操作" align="center" width='100' type=''>
          <template slot-scope="scope">
            <el-dropdown trigger="click">
              <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>
                  <el-link @click="gotoPage('/oa/autooffice/Mymail_update?CMID1='+scope.row.account_id+''+vueparams+'')">修改密码</el-link>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="gotoPage('/oa/autooffice/grant_update?CMID1='+scope.row.account_id+''+vueparams+'')">修改授权码</el-link>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="gotoPage('/oa/autooffice/Myqqmail_update?CMID1='+scope.row.account_id+''+vueparams+'')">修改密码</el-link>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="d_acc('&CMID1='+scope.row.account_id+'')">删除</el-link>
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
        <el-table-column label="邮箱" prop="mail_account">
        </el-table-column>
      </el-table>
      <el-button @click="gotoPage('/oa/autooffice/Mymail_insert?'+vueparams+'')" type='success' size="mini"><i class='fa fa-plus'></i>增加邮箱</el-button>
    </el-form>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'Myconfigure',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        s_person: {
          person_name: null,
          person_birthday: null,
          person_sex: null,
          person_politics: null,
          person_papercate: null,
          person_paperno: null,
        },
        s_relation: {
          relation_address: null,
          relation_zip: null,
          relation_tel: null,
          relation_cel: null,
        },
        s_email: [],
        l_pf: [],
        l_pt: [],
        loading: false,
        rules: {
          person_name: [{
            required: true,
            message: "姓名不能为空",
            trigger: 'blur',
          }],
          relation_cel: [{
            required: true,
            message: "手机不能为空",
            trigger: 'blur',
          }],
        }
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/oa/autooffice/Myacount/myconfigure?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      myconfigureSubmit(_params) {
        this.$refs["form"].validate(valid => {
          if (valid) {
            request({
              method: 'post',
              url: '/xcapi/VUEAction/oa/autooffice/Myacount/myconfigureSubmit?' + _params + this.vueparams,
              data: this.postData()
            }).then(data => {
              this.gotoPage("/oa/autooffice/Myconfigure/myconfigure?" + this.vueparams, data);
              this.msgSuccess(data.msg);
            })
          } else {
            this.msgError("必填项错误");
          }
        });
      },
      d_acc(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/oa/autooffice/Myacount/d_acc?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
    },
  }
</script>
